﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class NewsListView : System.Web.UI.UserControl
{
    public DataTable dt = null;
    public DataTable Dt { get { return dt; } set { dt = value; } }

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    public void Fetch_data()
    {
        if (dt != null) {
            int num = dt.Rows.Count;
            int index = 0;
            while (num > 0) {
                //HyperLink link = new HyperLink();
                //link.Text = dt.Rows[index]["title"].ToString();
                //link.NavigateUrl = "details.aspx?id=" + dt.Rows[index]["news_id"].ToString();
                listviewul.InnerHtml += "<li>" + "<a href='details.aspx?id=" + dt.Rows[index]["news_id"].ToString() +"' >" + dt.Rows[index]["title"].ToString() +"</a>" + "</li>"; 
                index++;
                num--;
            }
        }
    }
}